using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Voodoo.Sauce.Privacy.UI
{
	[RequireComponent(typeof(Canvas))]
	[RequireComponent(typeof(GraphicRaycaster))]
	public class CmpSettingsScreen : MonoBehaviour
	{
		public class Parameters
		{
			public Color mainColor;

			public string title;

			public string intro;

			public UnityAction accessDataAction;

			public string accessDataText;

			public UnityAction deleteDataCallback;

			public string deleteDataText;

			public UnityAction openCmpSettingsAction;

			public string openCmpSettingsText;

			public UnityAction closeCallback;

			public string closeText;
		}

		[SerializeField]
		private Text _titleText;

		[SerializeField]
		private Text _introText;

		[SerializeField]
		private Button _accessDataButton;

		[SerializeField]
		private Image _accessDataButtonImage;

		[SerializeField]
		private Text _accessDataButtonText;

		[SerializeField]
		private Button _deleteDataButton;

		[SerializeField]
		private Text _deleteDataButtonText;

		[SerializeField]
		private Image _deleteDataButtonImage;

		[SerializeField]
		private Button _openCmpSettingsButton;

		[SerializeField]
		private Text _openCmpSettingsButtonText;

		[SerializeField]
		private Image _openCmpSettingsButtonImage;

		[SerializeField]
		private Button _closeButton;

		[SerializeField]
		private Text _closeButtonText;

		public void Initialize(Parameters p)
		{
			_titleText.text = p.title;
			_introText.text = p.intro;
			_accessDataButton.onClick.RemoveAllListeners();
			_accessDataButton.onClick.AddListener(p.accessDataAction);
			_accessDataButtonText.text = p.accessDataText;
			_accessDataButtonImage.color = p.mainColor;
			_deleteDataButton.onClick.RemoveAllListeners();
			_deleteDataButton.onClick.AddListener(p.deleteDataCallback);
			_deleteDataButtonText.text = p.deleteDataText;
			_deleteDataButtonImage.color = p.mainColor;
			_openCmpSettingsButton.onClick.RemoveAllListeners();
			_openCmpSettingsButton.onClick.AddListener(p.openCmpSettingsAction);
			_openCmpSettingsButtonText.text = p.openCmpSettingsText;
			_openCmpSettingsButtonImage.color = p.mainColor;
			_closeButton.onClick.RemoveAllListeners();
			_closeButton.onClick.AddListener(p.closeCallback);
			_closeButtonText.text = p.closeText;
			_closeButtonText.color = p.mainColor;
		}
	}
}
